/*
 * Copyright (C) 2005-present, 58.com.  All rights reserved.
 * Use of this source code is governed by a BSD type license that can be
 * found in the LICENSE file.
 */

import 'package:flutter/material.dart' hide Gradient;

import 'utils.dart';
import 'dart:ui';

var p = () => {
      'AlwaysStoppedAnimation': (props) => AlwaysStoppedAnimation(
            props['pa'][0],
          ),
      'AnimationMax': (props) => AnimationMax(
            props['pa'][0],
            props['pa'][1],
          ),
      'AnimationMean': (props) => AnimationMean(
            left: props['left'],
            right: props['right'],
          ),
      'AnimationMin': (props) => AnimationMin(
            props['pa'][0],
            props['pa'][1],
          ),
      'CurvedAnimation': (props) => CurvedAnimation(
            parent: props['parent'],
            curve: props['curve'],
            reverseCurve: props['reverseCurve'],
          ),
      'ProxyAnimation': (props) => ProxyAnimation(
            props['pa'][0],
          ),
      'ReverseAnimation': (props) => ReverseAnimation(
            props['pa'][0],
          ),
      'TrainHoppingAnimation': (props) => TrainHoppingAnimation(
            props['pa'][0],
            props['pa'][1],
            onSwitchedTrain: props['onSwitchedTrain'],
          ),
      'AnimationBehavior': {
        'values': AnimationBehavior.values,
        'normal': AnimationBehavior.normal,
        'preserve': AnimationBehavior.preserve,
      },
      'AnimationController': (props) => AnimationController(
            value: props['value']?.toDouble(),
            duration: props['duration'],
            reverseDuration: props['reverseDuration'],
            debugLabel: props['debugLabel'],
            lowerBound: props['lowerBound']?.toDouble() ?? 0.0,
            upperBound: props['upperBound']?.toDouble() ?? 1.0,
            animationBehavior:
                props['animationBehavior'] ?? AnimationBehavior.normal,
            vsync: props['vsync'],
          ),
      'AnimationController.unbounded': (props) => AnimationController.unbounded(
            value: props['value']?.toDouble() ?? 0.0,
            duration: props['duration'],
            reverseDuration: props['reverseDuration'],
            debugLabel: props['debugLabel'],
            vsync: props['vsync'],
            animationBehavior:
                props['animationBehavior'] ?? AnimationBehavior.preserve,
          ),
      'AnimationStatus': {
        'values': AnimationStatus.values,
        'dismissed': AnimationStatus.dismissed,
        'forward': AnimationStatus.forward,
        'reverse': AnimationStatus.reverse,
        'completed': AnimationStatus.completed,
      },
      'BlendMode': {
        'values': BlendMode.values,
        'clear': BlendMode.clear,
        'src': BlendMode.src,
        'dst': BlendMode.dst,
        'srcOver': BlendMode.srcOver,
        'dstOver': BlendMode.dstOver,
        'srcIn': BlendMode.srcIn,
        'dstIn': BlendMode.dstIn,
        'srcOut': BlendMode.srcOut,
        'dstOut': BlendMode.dstOut,
        'srcATop': BlendMode.srcATop,
        'dstATop': BlendMode.dstATop,
        'xor': BlendMode.xor,
        'plus': BlendMode.plus,
        'modulate': BlendMode.modulate,
        'screen': BlendMode.screen,
        'overlay': BlendMode.overlay,
        'darken': BlendMode.darken,
        'lighten': BlendMode.lighten,
        'colorDodge': BlendMode.colorDodge,
        'colorBurn': BlendMode.colorBurn,
        'hardLight': BlendMode.hardLight,
        'softLight': BlendMode.softLight,
        'difference': BlendMode.difference,
        'exclusion': BlendMode.exclusion,
        'multiply': BlendMode.multiply,
        'hue': BlendMode.hue,
        'saturation': BlendMode.saturation,
        'color': BlendMode.color,
        'luminosity': BlendMode.luminosity,
      },
      'BlurStyle': {
        'values': BlurStyle.values,
        'normal': BlurStyle.normal,
        'solid': BlurStyle.solid,
        'outer': BlurStyle.outer,
        'inner': BlurStyle.inner,
      },
      'Clip': {
        'values': Clip.values,
        'none': Clip.none,
        'hardEdge': Clip.hardEdge,
        'antiAlias': Clip.antiAlias,
        'antiAliasWithSaveLayer': Clip.antiAliasWithSaveLayer,
      },
      'ClipOp': {
        'values': ClipOp.values,
        'difference': ClipOp.difference,
        'intersect': ClipOp.intersect,
      },
      'ColorFilter.mode': (props) => ColorFilter.mode(
            props['pa'][0],
            props['pa'][1],
          ),
      'ColorFilter.matrix': (props) => ColorFilter.matrix(
            props['pa'][0],
          ),
      'ColorFilter.linearToSrgbGamma': (props) =>
          ColorFilter.linearToSrgbGamma(),
      'ColorFilter.srgbToLinearGamma': (props) =>
          ColorFilter.srgbToLinearGamma(),
      'FilterQuality': {
        'values': FilterQuality.values,
        'none': FilterQuality.none,
        'low': FilterQuality.low,
        'medium': FilterQuality.medium,
        'high': FilterQuality.high,
      },
      'Gradient.linear': (props) => Gradient.linear(
            props['pa'][0],
            props['pa'][1],
            props['pa'][2],
            props['pa'][3],
            props['pa'][4],
            props['pa'][5],
          ),
      'Gradient.radial': (props) => Gradient.radial(
            props['pa'][0],
            props['pa'][1]?.toDouble(),
            props['pa'][2],
            props['pa'][3],
            props['pa'][4],
            props['pa'][5],
            props['pa'][6],
            props['pa'][7]?.toDouble(),
          ),
      'Gradient.sweep': (props) => Gradient.sweep(
            props['pa'][0],
            props['pa'][1],
            props['pa'][2],
            props['pa'][3],
            props['pa'][4]?.toDouble(),
            props['pa'][5]?.toDouble(),
            props['pa'][6],
          ),
      'ImageByteFormat': {
        'values': ImageByteFormat.values,
        'rawRgba': ImageByteFormat.rawRgba,
        'rawUnmodified': ImageByteFormat.rawUnmodified,
        'png': ImageByteFormat.png,
      },
      'ImageFilter.blur': (props) => ImageFilter.blur(
            sigmaX: props['sigmaX']?.toDouble() ?? 0.0,
            sigmaY: props['sigmaY']?.toDouble() ?? 0.0,
          ),
      'ImageFilter.matrix': (props) => ImageFilter.matrix(
            props['pa'][0],
            filterQuality: props['filterQuality'] ?? FilterQuality.low,
          ),
      'Paint': {
        'enableDithering': Paint.enableDithering,
      },
      'PaintingStyle': {
        'values': PaintingStyle.values,
        'fill': PaintingStyle.fill,
        'stroke': PaintingStyle.stroke,
      },
      'PathFillType': {
        'values': PathFillType.values,
        'nonZero': PathFillType.nonZero,
        'evenOdd': PathFillType.evenOdd,
      },
      'PathOperation': {
        'values': PathOperation.values,
        'difference': PathOperation.difference,
        'intersect': PathOperation.intersect,
        'union': PathOperation.union,
        'xor': PathOperation.xor,
        'reverseDifference': PathOperation.reverseDifference,
      },
      'PixelFormat': {
        'values': PixelFormat.values,
        'rgba8888': PixelFormat.rgba8888,
        'bgra8888': PixelFormat.bgra8888,
      },
      'PointMode': {
        'values': PointMode.values,
        'points': PointMode.points,
        'lines': PointMode.lines,
        'polygon': PointMode.polygon,
      },
      'StrokeCap': {
        'values': StrokeCap.values,
        'butt': StrokeCap.butt,
        'round': StrokeCap.round,
        'square': StrokeCap.square,
      },
      'StrokeJoin': {
        'values': StrokeJoin.values,
        'miter': StrokeJoin.miter,
        'round': StrokeJoin.round,
        'bevel': StrokeJoin.bevel,
      },
      'TileMode': {
        'values': TileMode.values,
        'clamp': TileMode.clamp,
        'repeated': TileMode.repeated,
        'mirror': TileMode.mirror,
      },
      'VertexMode': {
        'values': VertexMode.values,
        'triangles': VertexMode.triangles,
        'triangleStrip': VertexMode.triangleStrip,
        'triangleFan': VertexMode.triangleFan,
      },
      'BoxHeightStyle': {
        'values': BoxHeightStyle.values,
        'tight': BoxHeightStyle.tight,
        'max': BoxHeightStyle.max,
        'includeLineSpacingMiddle': BoxHeightStyle.includeLineSpacingMiddle,
        'includeLineSpacingTop': BoxHeightStyle.includeLineSpacingTop,
        'includeLineSpacingBottom': BoxHeightStyle.includeLineSpacingBottom,
        'strut': BoxHeightStyle.strut,
      },
      'BoxWidthStyle': {
        'values': BoxWidthStyle.values,
        'tight': BoxWidthStyle.tight,
        'max': BoxWidthStyle.max,
      },
      'FontStyle': {
        'values': FontStyle.values,
        'normal': FontStyle.normal,
        'italic': FontStyle.italic,
      },
      'FontWeight': {
        'w100': FontWeight.w100,
        'w200': FontWeight.w200,
        'w300': FontWeight.w300,
        'w400': FontWeight.w400,
        'w500': FontWeight.w500,
        'w600': FontWeight.w600,
        'w700': FontWeight.w700,
        'w800': FontWeight.w800,
        'w900': FontWeight.w900,
        'normal': FontWeight.normal,
        'bold': FontWeight.bold,
        'values': FontWeight.values,
      },
      'PlaceholderAlignment': {
        'values': PlaceholderAlignment.values,
        'baseline': PlaceholderAlignment.baseline,
        'aboveBaseline': PlaceholderAlignment.aboveBaseline,
        'belowBaseline': PlaceholderAlignment.belowBaseline,
        'top': PlaceholderAlignment.top,
        'bottom': PlaceholderAlignment.bottom,
        'middle': PlaceholderAlignment.middle,
      },
      'TextAffinity': {
        'values': TextAffinity.values,
        'upstream': TextAffinity.upstream,
        'downstream': TextAffinity.downstream,
      },
      'TextAlign': {
        'values': TextAlign.values,
        'left': TextAlign.left,
        'right': TextAlign.right,
        'center': TextAlign.center,
        'justify': TextAlign.justify,
        'start': TextAlign.start,
        'end': TextAlign.end,
      },
      'TextBaseline': {
        'values': TextBaseline.values,
        'alphabetic': TextBaseline.alphabetic,
        'ideographic': TextBaseline.ideographic,
      },
      'TextDecoration': {
        'none': TextDecoration.none,
        'underline': TextDecoration.underline,
        'overline': TextDecoration.overline,
        'lineThrough': TextDecoration.lineThrough,
      },
      'TextDecorationStyle': {
        'values': TextDecorationStyle.values,
        'solid': TextDecorationStyle.solid,
        'double': TextDecorationStyle.double,
        'dotted': TextDecorationStyle.dotted,
        'dashed': TextDecorationStyle.dashed,
        'wavy': TextDecorationStyle.wavy,
      },
      'TextDirection': {
        'values': TextDirection.values,
        'rtl': TextDirection.rtl,
        'ltr': TextDirection.ltr,
      },
      'TextRange': {
        'empty': TextRange.empty,
      },
      'TextStyle': (props) => TextStyle(
            color: props['color'],
            decoration: props['decoration'],
            decorationColor: props['decorationColor'],
            decorationStyle: props['decorationStyle'],
            decorationThickness: props['decorationThickness']?.toDouble(),
            fontWeight: props['fontWeight'],
            fontStyle: props['fontStyle'],
            textBaseline: props['textBaseline'],
            fontFamily: props['fontFamily'],
            fontFamilyFallback: as<String>(props['fontFamilyFallback']),
            fontSize: props['fontSize']?.toDouble(),
            letterSpacing: props['letterSpacing']?.toDouble(),
            wordSpacing: props['wordSpacing']?.toDouble(),
            height: props['height']?.toDouble(),
            locale: props['locale'],
            background: props['background'],
            foreground: props['foreground'],
            shadows: as<Shadow>(props['shadows']),
            fontFeatures: as<FontFeature>(props['fontFeatures']),
          ),
      'Curves': {
        'linear': Curves.linear,
        'decelerate': Curves.decelerate,
        'fastLinearToSlowEaseIn': Curves.fastLinearToSlowEaseIn,
        'ease': Curves.ease,
        'easeIn': Curves.easeIn,
        'easeInToLinear': Curves.easeInToLinear,
        'easeInSine': Curves.easeInSine,
        'easeInQuad': Curves.easeInQuad,
        'easeInCubic': Curves.easeInCubic,
        'easeInQuart': Curves.easeInQuart,
        'easeInQuint': Curves.easeInQuint,
        'easeInExpo': Curves.easeInExpo,
        'easeInCirc': Curves.easeInCirc,
        'easeInBack': Curves.easeInBack,
        'easeOut': Curves.easeOut,
        'linearToEaseOut': Curves.linearToEaseOut,
        'easeOutSine': Curves.easeOutSine,
        'easeOutQuad': Curves.easeOutQuad,
        'easeOutCubic': Curves.easeOutCubic,
        'easeOutQuart': Curves.easeOutQuart,
        'easeOutQuint': Curves.easeOutQuint,
        'easeOutExpo': Curves.easeOutExpo,
        'easeOutCirc': Curves.easeOutCirc,
        'easeOutBack': Curves.easeOutBack,
        'easeInOut': Curves.easeInOut,
        'easeInOutSine': Curves.easeInOutSine,
        'easeInOutQuad': Curves.easeInOutQuad,
        'easeInOutCubic': Curves.easeInOutCubic,
        'easeInOutQuart': Curves.easeInOutQuart,
        'easeInOutQuint': Curves.easeInOutQuint,
        'easeInOutExpo': Curves.easeInOutExpo,
        'easeInOutCirc': Curves.easeInOutCirc,
        'easeInOutBack': Curves.easeInOutBack,
        'fastOutSlowIn': Curves.fastOutSlowIn,
        'slowMiddle': Curves.slowMiddle,
        'bounceIn': Curves.bounceIn,
        'bounceOut': Curves.bounceOut,
        'bounceInOut': Curves.bounceInOut,
        'elasticIn': Curves.elasticIn,
        'elasticOut': Curves.elasticOut,
        'elasticInOut': Curves.elasticInOut,
      },
    };
